package com.ayuku.course.ui.student;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public class CompStudent extends Composite {

	int dateSelected = 0;
	private DateTime dateTime;
	private DateTime dtBirthDate;
	private Text text;
	private Text text_1;
	private Text text_2;

	private Text text_3;

	private Text text_4;
	private Text txtAlamat;
	private Text txtEmail;
	private Text txtName;
	private Text txtNoInduk;
	private Text txtOrangTua;
	private Text txtTempatLahir;
	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public CompStudent(Composite parent, int style) {
		super(parent, SWT.NONE);

		GridLayout gridLayout = new GridLayout(2, false);
		gridLayout.marginWidth = 6;
		setLayout(gridLayout);

		Label lblTanggalDaftar = new Label(this, SWT.NONE);
		lblTanggalDaftar.setText("Tanggal Daftar");

		dateTime = new DateTime(this, SWT.BORDER);

		Label lbl1 = new Label(this, SWT.NONE);
		lbl1.setText("No Induk");

		txtNoInduk = new Text(this, SWT.BORDER);
		txtNoInduk.setTextLimit(10);
		txtNoInduk.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
				false, 1, 1));

		Label lb2 = new Label(this, SWT.NONE);
		lb2.setText("Nama");

		txtName = new Text(this, SWT.BORDER);
		txtName.setTextLimit(30);
		txtName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false,
				1, 1));

		Label lb6 = new Label(this, SWT.NONE);
		lb6.setText("Email");

		txtEmail = new Text(this, SWT.BORDER);
		txtEmail.setTextLimit(30);
		txtEmail.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1,
				1));

		Label lblPhonme = new Label(this, SWT.NONE);
		lblPhonme.setText("Phone");

		text = new Text(this, SWT.BORDER);
		text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

		Label lb4 = new Label(this, SWT.NONE);
		lb4.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
		lb4.setText("Alamat");

		txtAlamat = new Text(this, SWT.BORDER | SWT.WRAP | SWT.MULTI);
		txtAlamat.setTextLimit(100);
		GridData gd_txtAlamat = new GridData(SWT.FILL, SWT.FILL, false, false,
				1, 1);
		gd_txtAlamat.heightHint = 68;
		txtAlamat.setLayoutData(gd_txtAlamat);

		Label lb5 = new Label(this, SWT.NONE);
		lb5.setText("Jenis Kelamin");

		Combo cmbKelamin = new Combo(this, SWT.NONE);
		cmbKelamin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
				false, 1, 1));

		Label lblNewLabel = new Label(this, SWT.NONE);
		lblNewLabel.setText("Tempat Lahir");

		txtTempatLahir = new Text(this, SWT.BORDER);
		txtTempatLahir.setTextLimit(10);
		txtTempatLahir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
				false, 1, 1));

		Label lb8 = new Label(this, SWT.NONE);
		lb8.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
		lb8.setText("Tanggal Lahir");

		dtBirthDate = new DateTime(this, SWT.BORDER | SWT.DROP_DOWN);
		dtBirthDate.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent arg0) {
				dateHasSelected(arg0);
			}
		});
		dtBirthDate.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false,
				1, 1));

		Label label = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL);
		label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2,
				1));

		Label lblOrangTuawali = new Label(this, SWT.NONE);
		lblOrangTuawali.setText("Orang Tua/Wali");

		txtOrangTua = new Text(this, SWT.BORDER);
		txtOrangTua.setTextLimit(30);
		txtOrangTua.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
				false, 1, 1));

		Label lblPendidikan = new Label(this, SWT.NONE);
		lblPendidikan.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
				false, 1, 1));
		lblPendidikan.setText("Pendidikan Ortu/Wali");

		text_1 = new Text(this, SWT.BORDER);
		text_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1,
				1));

		Label lblPekerjaanOrtuwali = new Label(this, SWT.NONE);
		lblPekerjaanOrtuwali.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER,
				false, false, 1, 1));
		lblPekerjaanOrtuwali.setText("Pekerjaan Ortu/Wali");

		text_2 = new Text(this, SWT.BORDER);
		text_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1,
				1));

		Label lblNoTelpon = new Label(this, SWT.NONE);
		lblNoTelpon.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
				false, 1, 1));
		lblNoTelpon.setText("No Telpon Ortu/Wali");

		text_3 = new Text(this, SWT.BORDER);
		text_3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1,
				1));

		Label lblAlamat = new Label(this, SWT.NONE);
		lblAlamat.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
				false, 1, 1));
		lblAlamat.setText("Alamat Ortu/Wali");

		text_4 = new Text(this, SWT.BORDER);
		text_4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1,
				1));

	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}

	protected void dateHasSelected(SelectionEvent arg0) {
		dateSelected = 1;
	}

	public int getDateSelected() {
		return dateSelected;
	}

	public DateTime getDateTime() {
		return dtBirthDate;
	}

	public Text getTxtAlamat() {
		return txtAlamat;
	}

	public Text getTxtEmail() {
		return txtEmail;
	}

	public Text getTxtKode() {
		return txtNoInduk;
	}

	public Text getTxtLevel() {
		return txtTempatLahir;
	}

	public Text getTxtName() {
		return txtName;
	}

	public Text getTxtPhone() {
		return txtOrangTua;
	}

	public void setDateSelected(int dateSelected) {
		this.dateSelected = dateSelected;
	}

	public void setDateTime(DateTime dateTime) {
		this.dtBirthDate = dateTime;
	}

	public void setTxtAlamat(Text txtAlamat) {
		this.txtAlamat = txtAlamat;
	}

	public void setTxtEmail(Text txtEmail) {
		this.txtEmail = txtEmail;
	}

	public void setTxtKode(Text txtKode) {
		this.txtNoInduk = txtKode;
	}

	public void setTxtLevel(Text txtLevel) {
		this.txtTempatLahir = txtLevel;
	}

	public void setTxtName(Text txtNama) {
		this.txtName = txtNama;
	}

	public void setTxtPhone(Text txtPhone) {
		this.txtOrangTua = txtPhone;
	}

}
